var tap='http://bit.ly/warm1hd,http://bit.ly/warm2hd';
tap=tap.split(',');
if(tap[0].match(/(\*)/ig)){
tap1=tap[0].split('*')[0]
} else {
tap1=tap[0];
}
if(tap1.match(/(embed)/ig)){
document.getElementsByName('object')[0].data=tap1;
document.getElementsByName('object')[0].src=tap1;
}
else if(tap1.match(/(picasaweb)/ig)){
document.getElementsByName('object')[0].data='http://demo3.icolor.vn/daiduong/templates/apicloudnature/?url='+tap1;
document.getElementsByName('object')[0].src='http://demo3.icolor.vn/daiduong/templates/apicloudnature/?url='+tap1;
document.getElementsByName('list_download')[0].innerHTML='<iframe src="site_down_sv2.php?get-u='+tap1+'&amp;get-ti='+document.title+'" width="50%" height="35px" frameborder="0"></iframe>';
}
else{
document.getElementsByName('object')[0].data='http://demo3.icolor.vn/daiduong/templates/mode1/?url='+tap1;
document.getElementsByName('object')[0].src='http://demo3.icolor.vn/daiduong/templates/mode1/?url='+tap1;
document.getElementsByName('list_download')[0].innerHTML='<a href="'+tap1+'" target="_blank"><button class="btn_dangnhap">720p</button></a>';
}
for(i=0;i<tap.length;i++){
if(tap[i].match(/(\*)/ig)){
  sub=tap[i].split('*');
  tsub=['A','B','C','D','E','F','G','H','I','J','K'];
  for(j=0;j<sub.length;j++){
     lsub=(i*1+1)+tsub[j];
     document.getElementsByName('list_tap')[0].innerHTML+='<button class="btn_dangnhap" onclick="tap(\''+sub[j]+'\',\''+lsub+'\')">Tập '+lsub+'</button>';
  }
     document.getElementsByName('list_tap')[0].innerHTML+='<style>.tap'+(i*1+1)+'{display:none}</style>';
}
if(tap[i].match(/(http)/ig)){
document.getElementsByName('list_tap')[0].innerHTML+='<button class="btn_dangnhap tap'+(i*1+1)+'" onclick="tap(\''+tap[i]+'\',\''+(i+1)+'\')">Tập '+(i+1)+'</button>';
}
}


rpva=document.getElementsByName('rpva')[0].value;
function tap(id,dang){
     if(id.match(/(embed)/ig)){
         document.getElementsByName('object')[0].data=id;
         document.getElementsByName('object')[0].src=id;
         document.getElementsByName('dangxemtap')[0].innerHTML='- Tập '+dang;
         }
     else if(id.match(/(picasaweb)/ig)){
         document.getElementsByName('object')[0].data='http://demo3.icolor.vn/daiduong/templates/apicloudnature/?url='+id;
         document.getElementsByName('object')[0].src='http://demo3.icolor.vn/daiduong/templates/apicloudnature/?url='+id;
         document.getElementsByName('dangxemtap')[0].innerHTML='- Tập '+dang;
         document.getElementsByName('list_download')[0].innerHTML='<iframe src="site_down_sv2.php?get-u='+id+'&amp;get-ti='+document.title+'" width="50%" height="35px" frameborder="0"></iframe>';
         }
     else{
         document.getElementsByName('object')[0].data='http://demo3.icolor.vn/daiduong/templates/mode1/?url='+id;
         document.getElementsByName('object')[0].src='http://demo3.icolor.vn/daiduong/templates/mode1/?url='+id;
         document.getElementsByName('dangxemtap')[0].innerHTML='- Tập '+dang;
         document.getElementsByName('list_download')[0].innerHTML='<a href="'+id+'" target="_blank"><button class="btn_dangnhap">720p</button></a>';
}
     $("html, body").animate({ scrollTop: 0 }, "slow"); 
}
